package Concurrent;

import java.util.concurrent.Semaphore;

public class Semaphores {
    public static Semaphore semaphore = new Semaphore(3);

    public static void main(String[] args) throws InterruptedException {
        semaphore.acquire();
        System.out.println("执行一次 P 操作!!");
        semaphore.acquire();
        System.out.println("执行一次 P 操作!!");
        semaphore.acquire();
        System.out.println("执行一次 P 操作!!");
        semaphore.release();
        System.out.println("执行一次 V 操作!!");
    }
}
